import {create} from 'zustand';
//可以通过create创建仓库
const useStore = create((set)=>({
    count:0,
    add:()=>set(state=>({count:state.count+1})),
    minus:()=>set(state=>({count:state.count-1}))
}));

function ZustandApp(){
    const {count,add,minus} = useStore();
    return (
        <div>
            <p>{count}</p>
            <button onClick={add}>+</button>
            <button onClick={minus}>-</button>
        </div>
    )
}
export default ZustandApp;